<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link href="../../../common/js/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="footer.css" />
		<link rel="stylesheet" href="../../css/lystyle.css" />
		<script src="../../js/flexible.min.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			/*修改底部字体颜色*/
			
			.foot:nth-child(4) {
				color: #e83023;
			}
			
			.mui-switch {
				width: 52px;
				height: 31px;
				position: relative;
				border: 1px solid #dfdfdf;
				background-color: #fdfdfd;
				box-shadow: #dfdfdf 0 0 0 0 inset;
				border-radius: 20px;
				border-top-left-radius: 20px;
				border-top-right-radius: 20px;
				border-bottom-left-radius: 20px;
				border-bottom-right-radius: 20px;
				background-clip: content-box;
				display: inline-block;
				-webkit-appearance: none;
				user-select: none;
				outline: none;
			}
			
			.mui-switch:before {
				content: '';
				width: 29px;
				height: 29px;
				position: absolute;
				top: 0px;
				left: 0;
				border-radius: 20px;
				border-top-left-radius: 20px;
				border-top-right-radius: 20px;
				border-bottom-left-radius: 20px;
				border-bottom-right-radius: 20px;
				background-color: #fff;
				box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
			}
			
			.mui-switch:checked {
				border-color: #64bd63;
				box-shadow: #64bd63 0 0 0 16px inset;
				background-color: #64bd63;
			}
			
			.mui-switch:checked:before {
				left: 21px;
			}
			
			.mui-switch.mui-switch-animbg {
				transition: background-color ease 0.4s;
			}
			
			.mui-switch.mui-switch-animbg:before {
				transition: left 0.3s;
			}
			
			.mui-switch.mui-switch-animbg:checked {
				box-shadow: #dfdfdf 0 0 0 0 inset;
				background-color: #64bd63;
				transition: border-color 0.4s, background-color ease 0.4s;
			}
			
			.mui-switch.mui-switch-animbg:checked:before {
				transition: left 0.3s;
			}
			
			.mui-switch.mui-switch-anim {
				transition: border cubic-bezier(0, 0, 0, 1) 0.4s, box-shadow cubic-bezier(0, 0, 0, 1) 0.4s;
			}
			
			.mui-switch.mui-switch-anim:before {
				transition: left 0.3s;
			}
			
			.mui-switch.mui-switch-anim:checked {
				box-shadow: #64bd63 0 0 0 16px inset;
				background-color: #64bd63;
				transition: border ease 0.4s, box-shadow ease 0.4s, background-color ease 1.2s;
			}
			
			.mui-switch.mui-switch-anim:checked:before {
				transition: left 0.3s;
			}
			
			input {
				outline: none;
				border: 0;
			}
			
			label#kaiguan {
				outline: none;
				border: 0;
			}
			
			label#kaiguan:focus {
				outline: none;
				border: 0;
				;
			}
			
			input:focus {
				outline: none;
				border: 0;
				;
			}
			
			input:link {
				outline: none;
			}
			
			input:hover {
				outline: none;
			}
			
			input:active {
				outline: none;
			}
			
			#checkJinB {
				outline: none;
			}
		</style>
	</head>

	<body>
		<div id="wrap">
			<div id="main">
				<div id="header">
					<a id="headImg" href="javascript:history.go(-1)"><img class="headImg" src="../../images/12.png" /></a>
					<a href="../../../app/view/personage/person_myinfo.html" id="headRightImage"><img class="headRightImg" src="../../images/store/myself.png" /></a>
					<p id="headTitle">我的</p>
				</div>
				<div id="content">
					<!--内容-->
					<ul class="ly-person">
						<li class="ly-person-li">
							<a href="person_info.html">
								<span>我的信息</span><img src="../../images/personage/more.png" />
							</a>
						</li>
						<li class="ly-person-li">
							<a href="person_order.html">
								<span>我的订单</span><img src="../../images/personage/more.png" />
							</a>
						</li>
						<li class="ly-person-li">
							<a onclick="vipYf()">
								<span>提现申请</span><img src="../../images/personage/more.png" />
							</a>
						</li>
						<li class="ly-person-li">
							<a href="person_collect.html">
								<span>我的收藏</span><img src="../../images/personage/more.png" />
							</a>
						</li>
						<li class="ly-person-li">
							<a onclick="guestYf()">
								<span>创客后台登录</span><img src="../../images/personage/more.png" />
							</a>
						</li>
						<li class="ly-person-li">
							<a href="person_intentApply.html">
								<span>意向申请</span><img src="../../images/personage/more.png" />
							</a>
						</li>

						<!--<li class="ly-person-li" style="display: none;">
							<a href="person_invite.html">
								<span class="ly-person-span">添加公司邀请码</span><img src="../../images/personage/more.png" />
							</a>
						</li>-->
						<li class="ly-person-li">
							<a href="../store/gift_my/index.html">
								<span>我的礼品</span><img src="../../images/personage/more.png" />
							</a>
						</li>
						<li class="ly-person-li">
							<a href="../store/gift_sell/index.html">
								<span>售卖商品</span><img src="../../images/personage/more.png" />
							</a>
						</li>
						<li class="ly-person-li">
							<a href="../store/store_return/return_xz.html">
								<span>平台返购</span><img src="../../images/personage/more.png" />
							</a>
						</li>
						<li class="ly-person-li">
							<a href="person_fievalute.html">
								<span>我的评价</span><img src="../../images/personage/more.png" />
							</a>
						</li>
						<li class="ly-person-li">
							<a href="person_myGanen.html">
								<span>感恩机制</span><img src="../../images/personage/more.png" />
							</a>
						</li>
						<li class="ly-person-li">
							<a href="person_myinfo.html">
								<span>我的消息</span><img src="../../images/personage/more.png" />
							</a>
						</li>
						<li class="ly-person-li">
							<a href="person_setting.html">
								<span>设置</span><img src="../../images/personage/more.png" />
							</a>
						</li>
						<li class="ly-person-li" style="position: relative;">
							<a>
								<span>金币转化仁和币</span> <label id="kaiguan" readonly unselectable="no" style="position: absolute;right: 0.6rem;top: 0.1rem;"><input class="mui-switch mui-switch-anim"  id="checkJinB" type="checkbox"> </label>
							</a>
						</li>
					</ul>
				</div>
			</div>
			<div id="foot" class="row">
				<a class="foot col-xs-3 col-sm-3" href="../kaoqin/index2.html">
					<img class="footImg" src="../../images/15.png" />
					<p>管理</p>
				</a>
				<a class="foot col-xs-3 col-sm-3" href="../coalition/colalition.html">
					<img class="footImg" src="../../images/lianmengchushi.png" />
					<p>联盟</p>
				</a>
				<a class="foot col-xs-3 col-sm-3" href="../store/store.html">
					<img class="footImg" src="../../images/11.png" />
					<p>商城</p>
				</a>
				<a class="foot col-xs-3 col-sm-3" href="personIndex.html">
					<img class="footImg" src="../../images/myCheck.png" />
					<p>我的</p>
				</a>
			</div>
		</div>
	</body>
	<script src="../../js/jquery-2.2.3.min.js"></script>
	<script src="../../js/jquery.cookie.js"></script>
	<script src="../../../common/js/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
	<!--<script src="../../js/rhAdmin.js" type="text/javascript" charset="utf-8"></script>-->
	<script src="../../js/jquery.cookie.js"></script>
	<script>
		var tokenReztApp = $.cookie("tokenReztApp");
		if(!tokenReztApp) {
			window.location.href = "../login/login/login.html";
		}
		//用户信息
		var user, roles, goodsId;
		$(function() {
			currentyf();
		});
		//获取当前会员信息
		function currentyf() {
			$.ajax({
				cache: false,
				type: "GET",
				url: "http://47.104.13.109/member-service/auth/current?token=" + tokenReztApp,
				dataType: "JSON",
				async: true,
				error: function(XMLHttpRequest, textStatus, errorThrown) {
					$.removeCookie('tokenReztApp', {
						expires: 7,
						path: '/'
					});
					$.removeCookie("tokenRh", {
						expires: 7,
						path: '/'
					});
					$.removeCookie('memberId', {
						expires: 7,
						path: '/'
					});
					$.removeCookie('roleId', {
						expires: 7,
						path: '/'
					});
					window.location.href = "../login/login/login.html";
				},
				success: function(data) {
					/*if(data.roleList[0].id != "f2") {
						window.location.href = "../../app/view/login/login/login.html";
					}*/
					user = data.loginName;
					roles = data.roleList; //角色集合
					goodsId = data.id;

				}
			});
		}
		//是否是创客身份
		function guestYf() {
			var check = false;
			for(var i = 0; i < roles.length; i++) {
				var role = roles[i].id;
				var deadline = new Date(roles[i].deadline);
				if(role == "f2" && deadline >= new Date()) {
					check = true;
				}
			}
			if(check == true) {
				window.location.href = "../../../backstage/home/backstage_index.html";
			} else {
				alert("您不是创客，请认证或续费后再次尝试")
			}
		}

		//是否是会员身份
		function vipYf() {
			var check = false;
			for(var i = 0; i < roles.length; i++) {
				var role = roles[i].id;
				var deadline = new Date(roles[i].deadline);
				if(role == "f1" && deadline >= new Date()) {
					check = true;
				}
				if(role == "f2" && deadline >= new Date()) {
					check = true;
				}
			}
			if(check == true) {
				window.location.href = "person_cashform.html";
			} else {
				alert("您不是会员，请认证或续费后再次尝试")
			}
		}
		$("#checkJinB").click(function() {
			var check = false;
			for(var i = 0; i < roles.length; i++) {
				if(roles[i].id == 'f1' || roles[i].id == 'f2') {
					check = true;
				}
			}
			if(check) {
				if($("#checkJinB").is(':checked')) {
					$.ajax({
						type: "put",
						url: "http://47.104.13.109/gold-service/tfGoldSpare1",
						async: true,
						data: {
							memberId: $.cookie("memberId"),
							spare1: '1'
						},
						success: function(res) {
							console.log(res)
						}
					});
				} else {
					$.ajax({
						type: "put",
						url: "http://47.104.13.109/gold-service/tfGoldSpare1",
						async: true,
						data: {
							memberId: $.cookie("memberId"),
							spare1: '0'
						},
						success: function(res) {
							console.log(res)
						}
					});
				}
			} else {
				alert("您还不是会员")
				$("#checkJinB").removeAttr("checked")
			}

		})

		// 默认开关样式
		$.ajax({
			type: "get",
			url: "http://47.104.13.109:80/gold-service/tfGold/" + $.cookie("memberId"),
			async: true,
			success: function(res) {
				if(res.goldSpare1 == '1') {
					$("#checkJinB").attr("checked", 'checked')
				}

			}
		});
	</script>

</html>